package com.buka.service;

import com.buka.entity.Order;
import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

// OrderTccAction.java
@LocalTCC
public interface OrderTccAction {

    @TwoPhaseBusinessAction(name = "orderTccAction", commitMethod = "confirm", rollbackMethod = "cancel")
    boolean prepareCreateOrder(BusinessActionContext ctx,
                               @BusinessActionContextParameter("order") Order order);

    boolean confirm(BusinessActionContext ctx);

    boolean cancel(BusinessActionContext ctx);
}